|
|
|
|
|
|
|
two relationships. If the Training table has only one entry per employee, the two relationships are a one-to-one relationship between the Employees table and the Training table, and a one-to-many relationship between the Employees table and the EmpSkills table. Of course, if any employee has more than one degree, both relationships become one-to-many. |
|
|
|
|
| Table 16.4. The sample training data table. | | EmpID | | Degree | | YearCompleted | | InstitutionName |
|
|
|
|
|
|
Listing 16.7 is a sample SQL DDL statement that creates the Training data table with the proper relationship constraint. Enter this statement in the SQL window of Visdata while you have the NORMDAT4.MDB database open. Check your results against Figure 16.6. |
|
|
|
|
|
|
|
|
Listing 16.7. Creating the Training table. |
|
|
|
|
|
|
|
|
CREATE TABLE Training
(EmpID TEXT(5),
Degree TEXT(20),
YearCompleted INTEGER,
InstitutionName TEXT(30),
CONSTRAINT PKTraining PRIMARY KEY (EmpID,Degree),
CONSTRAINT FKEmpTrn FOREIGN KEY (EmpID)
REFERENCES Employees (EmpID)) |
|
|
|
|
|
|
|
|
The database NORMDAT5.MDB contains a complete version of the database normalized up to the fourth rule of data normalization. Use Visdata to open the database and review the table structure. |
|
|
|
|
| |
|
|
|
|
Before continuing with the lesson, load the NORMDAT5.MDB database into Visdata. |
|
|
|
|
|
|
|